package com.rk.pethome.org.service.impl;
import com.rk.pethome.basic.service.impl.BaseServiceImpl;
import com.rk.pethome.org.domain.Department;
import com.rk.pethome.org.mapper.DepartmentMapper;
import com.rk.pethome.org.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class IDepartmentServiceImpl extends BaseServiceImpl<Department> implements IDepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;
    
    @Override
    @Transactional
    public void addOrUpdate(Department department) {
        System.out.println("部门id" + department.getId());
        if (department.getId() == null) {//如果部门id为null就是新增
            this.add(department);//调用增加
        } else {
            this.update(department);//调用修改
        }
    }

}
